﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;
using NHibernateSample.Domain.Entities;

namespace NHibernateSample.DAL.Test
{
    [TestFixture]
    public class NHibernateSampleFixture
    {
        private NHibernateHelper _helper;
        private NHibernateSample _sample;
        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _helper = new NHibernateHelper();
            HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
        }

        [SetUp]
        public void Setup()
        {
            _sample = new NHibernateSample(_helper.GetSession());
        }

        [Test]
        public void GetCustomerByIdTest()
        {            
            var tempCutomer = new Customer{ FirstName = "李", LastName = "四" };
            _sample.CreateCustomer(tempCutomer);
            Customer customer = _sample.GetCustomerById(1);
            int customerId = customer.Id;
            Assert.AreEqual(1, customerId);
        }
    }
}
